using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Singleton<T> where T : class, new()
{
    private static readonly Object obj = new Object();
    private static T instance;
    protected Singleton() { }
    public static T GetSinleton()
    {
        if (instance == null)
        {
            lock (obj)
            {
                if (instance == null)
                {
                    instance = new T();
                }
            }
        }
        return instance;
    }
}
